1. Field of the Invention
The present invention relates to the field of computer software, and in particular to a method and apparatus for calling virtual machine across processes.
Sun, Sun Microsystems, the Sun logo, Solaris and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. All SPARC trademarks are used under license and are trademarks of SPARC International, Inc. in the United States and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc.
2. Background Art
Some computer applications make use of a virtual machine to perform some computations. For example, a Java virtual machine, JVM, is used to interpret and execute machine-independent Java code. Some applications must run in the same process as a virtual machine in order to use it. Since some applications are unable to use a virtual machine running in another process, another virtual machine is started in the application's process. As a result, memory is wasted by running duplicate virtual machines. This problem can be better understood by an examination of the Mozilla/Netscape6.x browser and blackConnect's interaction with a JVM.
Mozilla/Netscape 6.x, blackConnect and JVM
The Mozilla/Netscape 6.x browser is shipped with Sun Microsystems' Java plugin, which enables applet support for the browser. The Java plugin runs a JVM for the browser. Some applications, for example blackConnect which runs in the same process as the browser, require that the JVM runs in the same process as the application. If the Java plugin runs the JVM in the browser's process, blackConnect uses that JVM. If no JVM is found in the process, a new JVM is started.
On Solaris and Linux platforms, Sun Microsystems' Java plugin starts the JVM in a new process. Thus, this JVM is not accessible by blackConnect and blackConnect starts a new JVM. As a result, more than 20 megabytes of memory is wasted by the redundant JVM.